<template>
	<view class="header">
		<text class="iconfont icon-xiangzuojiantou"></text>
		<text>开团成功</text>
	</view>
	<view class="neirong">
		<view class="xinxi">
			<view class="tupian">
				<image :src="IP+see.yp_imgsrc" mode=""></image>
			</view>
			<view class="yaopin">
				<view>{{see.yp_mingcheng}}</view>
				<br>
				<text>2人拼</text>
				<text>￥{{see.pt_tuangoujiage}}</text>
				<text>已拼536件</text>
				<br>
				<view class="danjia">
					<text>单买价</text>
					<text>{{see.pt_jiage}}</text>
				</view>
			</view>
		</view>
	</view>
	<view class="shijian">
		<view>
			还差1人拼团成功，剩余
			<text style="color: red;">00:29:{{miao}}</text>
		</view>
		
	</view>
	<view class="zhaopian">
		<image :src="IP+see.y_imgsrc" mode=""></image>
		<image src="../../static/image/qiuxg/2.png" mode=""></image>
	</view>
	<view class="btn">
		<button type="warn" @click="fenxiang">
			邀请好友参团
		</button>
		<button type="warn" @click="chakan">
			查看订单详情
		</button>
	</view>
	<view>
		<!-- 分享示例 -->
		<uni-popup ref="share" type="share" safeArea backgroundColor="#fff">
		<uni-popup-share @select="select"></uni-popup-share>
		</uni-popup>
	</view>
</template>

<script>
	import {reactive,toRefs,onMounted,computed,watch} from 'vue'
	import {useStore} from 'vuex'
	import http from '../../utils/http.js'
	import store from '../../store/index.js'
	export default {
		setup(){
			const {state,getters,commit,dispatch} = useStore();
			let data=reactive({
				    miao:60,
				    jishiqi:'',
					IP:computed(()=>state.IP),
					see:computed(()=>state.ptdingdan.see),
				// 分享
				    fenxiang(){
						this.$refs.share.open()
					},
					select(){
						uni.showToast({
							title: '分享成功',
							duration: 2000,
							icon:'success'
						});
					},
				// 查看
				    chakan(){
						uni.navigateTo({url:'/pages/ptdaizhifu/ptdaizhifu'})
					}
			})
			onMounted(()=>{
				// data.IP=store.state.IP
				data.jishiqi=setInterval(()=>{
					data.miao--
				},1000);	
			}),
			watch(()=>data.miao,(n,o)=>{
				// console.log(n)
				if(n==0){
					clearInterval(data.jishiqi)
					data.miao=''
				}
			})
			return {...toRefs(data)}
		}
	}
</script>

<style lang="scss">
	@import url("~@/static/fonts/iconfont.css");
    .header{
		border-bottom: 1px solid #F2F2F2;
		padding-bottom: 20rpx;
	}
	.xinxi{
		border: 1px solid #F2F2F2;
		font-size: 26rpx;
		display: flex;
		padding: 20rpx 20rpx;
	}
	.tupian{
		image{
			width: 220rpx;
			height: 200rpx;
		}
	}
	.yaopin{
		margin-left: 40rpx;
		view:nth-of-type(1){
			padding: 40rpx 0;
		}
		text{
			margin: 0rpx 10rpx;
		}
			
		text:nth-of-type(1){
			border: 1px solid red;
			color: gray;
		}
		text:nth-of-type(2){
			color: red;
		}
		text:nth-of-type(3){
			color: gray;
		}
	}
	.danjia{
		margin-top: 40rpx;
		text:nth-of-type(1){
			border: 0;
			color: gray;
		}
		text:nth-of-type(2){
			color: gray;
			text-decoration: line-through;	
		}
	}
	.neirong{
		padding: 50rpx;
	}
	.shijian{
		padding: 50rpx;
		text-align: center;
	}
	.zhaopian{
		text-align: center;
		image{
			width: 120rpx;
			height: 100rpx;
			margin-top: 20rpx;
		}
	}
	.btn{
		margin-top: 80rpx;
		padding: 0 50rpx;
		display: flex;
		justify-content: space-around;
	}
</style>
